<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/sinopac-fn" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${fn:url('/form/CSS/tabs.css')}">
<script type="text/javascript" src="${fn:url('/js/jQuery/jquery-1.8.2.min.js')}"></script>
<script type="text/javascript" src="${fn:url('/js/jQuery/jquery_DOMWindow.js')}"></script>
<script type="text/javascript" src="${fn:url('/js/tools/formUtil.js')}"></script>
<script>
	function getCustomer_id(custId){
		alert(custId);
		var form = $('#form1');
		form.prop('action', '${fn:url('/Index/chkCustId.action')}');
		form.append('<input type="hidden" name="function_num" value="2" />');
		form.append('<input type="hidden" name="custId" value="'+custId+'" />');
		form.submit();
	}
	$(document).ready(function(){
		$('#token_esn').click(function(){
			var self = $(this);
			var voValue = self.attr('voValue');
			var form = $('#form1');
			form.prop('action', '${fn:url('/Index/chkCustId.action')}');
			form.append('<input type="hidden" name="function_num" value="4" />');
			form.append('<input type="hidden" name="token_esn" value="'+voValue+'" />');
			form.submit();
		});
		if($("tr").size()==0){
			alert("此次上傳檔案失敗");
			var form = $('#form1');
			form.prop('action', "${fn:url('/Index/backMain.action')}");
			form.submit();
		}
	});
</script>
<title>申請配發確認</title>
</head>
<body>
	<%@ include file="/form/include/title.jsp" %>
	<s:form id="form1">
		<br>
		<br>
		<div align="center">
			批次上傳:<s:property value="total_cnt"/>筆,處理正確:<s:property value="reportList.size()"/>筆
		</div>
		<table class="table-style" align="center">
		<tr>
			<th style="width: 50px">項次</th>
			<th style="width: 220px">客戶ID</th>
			<th>客戶名稱</th>
			<th>AO Code</th>
			<th>TOKEN ESN</th>
			<th>OTP 狀態</th>
		</tr>
		<s:iterator value="reportList" var="report" status="row">
		<s:hidden name="reportList[%{#row.index}].custId"/>
		<s:hidden name="reportList[%{#row.index}].tokenEsn"/>
		<s:iterator value="customerList" status="c" var="cus">
			<tr>
				<td align="center"><s:property value="%{#row.index+1}"/></td>
				<td><s:property value="customer_id"/></td>
				<td><s:property value="customer_name"/></td>
				<td><s:property value="ao_code"/></td>
				<td><s:property value="tokenEsn"/></td>
				<td><s:property value="otp_status_msg"/></td>
			</tr>
		</s:iterator>
		</s:iterator>
		</table>
		<table align="center">
			<tr>
				<td>
					<s:submit theme="simple" value="確認及列印領據" action="printRoport"></s:submit>
					<s:submit theme="simple" value="取消" action="index"></s:submit>
					<input type="hidden" name="token_esn" value="<s:property value="token_esn"/>" />
				</td>
			</tr>
		</table>
	</s:form>
</body>
</html>